package com.example.pojo.entity.jpa;

import jdk.nashorn.internal.objects.annotations.Constructor;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;

/**
 * @author LiYuhang
 * @version 0.1
 * @application
 * @Date 2020/9/20 11:24
 */
@Entity
@Data
@ToString
@AllArgsConstructor
public class User {

    public User(){

    }
    public User(String userName, String passWord, String email, String nickName, String regTime) {
        this.userName = userName;
        this.passWord = passWord;
        this.email = email;
        this.nickName = nickName;
        this.regTime = regTime;
    }

    /**
     * 主键自增
     */
    @Id
    @GeneratedValue
    private Long id;
    /**
     * 唯一 不为null
     */
    @Column(nullable = false, unique = true)
    private String userName;
    @Column(nullable = false)
    private String passWord;
    @Column(nullable = false, unique = true)
    private String email;
    /**
     * 唯一 可以为null
     */
    @Column(nullable = true, unique = true)
    private String nickName;
    @Column(nullable = false)
    private String regTime;
}
